package com.sishu.njrtsdms.annotation;

import com.sishu.njrtsdms.validate.DateTimeValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {DateTimeValidator.class})
public @interface ValidDateTime {

    String message() default "无效的日期时间,合法的日期时间格式为:[yyyy-MM-dd'T'HH:mm:ss]";

    String pattern() default "yyyy-MM-dd'T'HH:mm:ss"; // 默认日期时间格式

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
